<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>

     <link rel="stylesheet" type="text/css" href="../css/app.css" />
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
    
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="../script/app.js" ></script>
	
	
    <style>
    	body{
    		
    	}
    	
    	.del_btn{
    		padding-top: 25px;
			padding-left: 5px;
			display: none;
			width: 30px
    	}

    </style>
</head>
<body>
	
	<div id="empytCollect" style="display: none;">
		<span class="H-center-all" style="margin-top:50px;">
			 <img src="../image/huidianpu.png" class="H-border-both H-width-90 H-display-block" style="height:90px">
			 
		</span>
		<p class="H-center-all H-theme-font-color-333">你还没有收藏商户</p>
	</div>
    <div id="list" style="">
    	
    	<!--<div onclick="$app.openWinByUrl('shop_detail','shop_detail',{'title':'{{= v.title}}','img':'{{= v.img}}', 'url':'{{= v.url}}' , 'type':'ds'  })" class="movie_float_re  H-display-table-cell H-width-avg-2 H-float-left H-box-sizing-border-box H-padding-horizontal-both-5">
	                <img src="{{= v.img}}" class=" H-display-block H-width-100-percent" style="height:90px;">
	                <div class="H-text-show-row-1  H-font-size-14">{{= v.title}}</div>
	                <span class="H-text-show-row-1 H-font-size-14 H-theme-font-color-ccc ">{{= v.desc}}</span>
	                <div class="movie_float_ab H-font-size-12">{{= v.update}}</div>
	            </div>-->
	            
    </div>
    
    <script  id="listtmp" type="text/x-dot-template">
	    {{? it && it.length > 0}}<!--it 就是传入的数组data 这里判断是否为真，数组元素是否大于0个 ?相当于if-->
			{{~ it :v}}<!--it 相当如js的foreach v就是data数组中的一个元素-->
	    		
	            <div onclick="$app.openWinByUrl('shop_detail','shop_detail',{'title':'{{= v.title}}','img':'{{= v.img}}', 'url':'{{= v.url}}' , 'type':'ds'  })" class="dashed-line H-position-relative H-flexbox-horizontal H-box-sizing-border-box H-padding-10 H-border-vertical-bottom-after">
		            <img src="{{= v.img}}" class="H-border-both  H-display-block" style="width:120px;height:70px">
			        <div class="H-flex-item H-box-sizing-border-box H-overflow-hidden">
			            <div class=" H-font-size-16 H-padding-horizontal-both-10 H-text-show-row-2 H-theme-font-color-333">
			            	<label class="H-font-weight-bold">{{= v.title}}</label>
			            </div>
			            {{? v.type == 'ds'  || v.type == 'dm'}}
			            	<div class="H-padding-horizontal-both-10  H-font-size-12 H-theme-font-color-333">上次看到第{{= v.last_update}}集</div>
			            {{?}}
			            {{? v.type == 'zy'}}
			            	<div class="H-padding-horizontal-both-10  H-font-size-12 H-theme-font-color-333">上次看到:{{= v.last_update}}</div>
			            {{?}}
			            <div class="H-padding-horizontal-both-10  H-font-size-12 H-theme-font-color-ccc">{{= v.add_time}}</div>
			         </div>
		    	</div>
	       {{~}}
		{{?}}<!--相当于/if -->
    </script>

 
    
</body>

<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript">

	var is_edit = 0;
	var page = 1;
	var is_page = true;
	var uid = localStorage.getItem('uid');
	var token = localStorage.getItem('token');
	apiready = function(){
		api.parseTapmode();
		
		api.setRefreshHeaderInfo({
		    loadingImg: 'widget://image/refresh.png',
		    bgColor: '#ccc',
		    textColor: '#fff',
		    textDown: '下拉刷新...',
		    textUp: '松开刷新...'
		}, function(ret, err) {
		    //在这里从服务器加载数据，加载完成后调用api.refreshHeaderLoadDone()方法恢复组件到默认状态
		    page=1;
		    is_page =true;
			ready();
			
		});
		
		api.addEventListener({
            name:'refere_record'
        },function(ret,err){
        	page=1;
		    is_page =true;
			ready();
        });
		
		api.addEventListener({
		    name:'scrolltobottom',
		    extra:{
		        threshold:0            //设置距离底部多少距离时触发，默认值为0，数字类型
		    }
		}, function(ret, err){        
		    if(is_page ==true){
		    	page++;
		    	ready();
		    }
		});

		ready();
	
		
	};
	
	
	function ready(){
		$app.ajax($app.serverUrl+"index/user/user_record",{ 'token':token , 'page':page , 'page_size':20},'post',function(ret){
			api.refreshHeaderLoadDone();
			if( ret.status == 1000){
				if( ret.data.current_page >= ret.data.last_page){
					is_page = false;
				}
				var evalText = doT.template($("#listtmp").text());
				if( page ==1 ){
					$("#list").html(evalText(ret.data.data));
				} else {
					$("#list").append(evalText(ret.data.data));
				}
			}
		});
	}
	

</script>
</html>